#!/bin/sh
# /etc/acpi/powerbtn.sh
# Initiates a shutdown when the power putton has been
# pressed.

# Skip if we just in the middle of resuming.
test -f /var/lock/acpisleep && exit 0

# If gnome-power-manager, kded4, dalston-power-applet or xfce4-power-manager
# are running, let them handle policy This is effectively the same as
# 'acpi-support's '/usr/share/acpi-support/policy-funcs' file.

if pidof gnome-power-manager kded4 dalston-power-applet xfce4-power-manager > /dev/null; then
    exit
fi

# If all else failed, just initiate a plain shutdown.
/sbin/shutdown -h now "Power button pressed"
